


class AsyncHandler(object):

    def handle_operation(self, type_, value, act):
        if type_ == "accept":
            self.handle_accept(*value, act)
        elif type == "connect":
            self.handle_connect(value, act)
        elif type == "recv":
            self.handle_recv(value, act)
        elif type == "send":
            self.handle_send(value, act)
        else:
            raise ValueError, "unknown operation type"


    def handle_accept(self, client_socket, remote_address, act):
        raise NotImplementedException, "unsupported operation"


    def handle_connect(self, act):
        raise NotImplementedException, "unsupported operation"


    def handle_recv(self, buf, act):
        raise NotImplementedException, "unsupported operation"


    def handle_send(self, cnt, act):
        raise NotImplementedException, "unsupported operation"
